using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Generic;
namespace Ent.Web.Helper
{
    public enum DateField { Date, Month, Year }
    public class DateHelper
    {
        private static Dictionary<string, int> Date = new Dictionary<string, int>();
        private static Dictionary<string, int> Month = new Dictionary<string, int>();
        private static Dictionary<string, int> Year = new Dictionary<string, int>();
        private static void Init()
        {
            for (int i = 1; i <= 31; i++)
            {
                Date.Add(i.ToString(), i);
            }
            for (int i = 1930; i <= 2011; i++)
            {
                Year.Add(i.ToString(), i);
            }
            Month.Add("JAN", 1);
            Month.Add("FEB", 2);
            Month.Add("MAR", 3);
            Month.Add("APR", 4);
            Month.Add("MAY", 5);
            Month.Add("JUN", 6);
            Month.Add("JUL", 7);
            Month.Add("AUG", 8);
            Month.Add("SEP", 9);
            Month.Add("OCT", 10);
            Month.Add("NOV", 11);
            Month.Add("DEC", 12);
        }
        public static Dictionary<string, int> GetCollection(DateField field)
        {
            if (Date.Count == 0)
                Init();
            switch (field)
            { 
                case DateField.Date:
                    return Date;
                case DateField.Month:
                    return Month;
                default:
                case DateField.Year:
                    return Year;
            }
        }
    }
}
